public class Person {
	public String name;
	public String surname;
	public int age;
	public String phone;

	public Person(String name, String surname, int age, String phone) {
		this.name = name;
		this.surname = surname;
		this.age = age;
		this.phone = phone;
	}

	public String getName() {
		return name;
	}

	public String getSurname() {
		return surname;
	}

	public int getAge() {
		return age;
	}

	public String getPhone() {
		return phone;
	}
	public void setName(String scannedName) {
		name = scannedName;
	}
	public void setSurname(String scannedSurname) {
		surname = scannedSurname;
	}
	public void setAge(int scannedAge) {
		age = scannedAge;
	}
	public void setPhone(String scannedPhone) {
		phone = scannedPhone;
	}
	/*public void addPerson() {
		setName(name);
		setSurname(surname);
		setAge(age);
		setPhone(phone);
	}*/

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (this == obj) {
			return true;
		}
		if (this.getClass() == obj.getClass()) {
			Person person = (Person) obj;
			if ((person.name.equals(name)) && (person.surname.equals(surname))
					&& (person.age == age) && (person.phone == phone)) {
				return true;
			}
		}
		return false;
	}

	@Override
	public int hashCode() {
		int hash = 1;
		hash = hash * 17 + (int) age;
		hash = 17*hash + name.hashCode()+ surname.hashCode()+ phone.hashCode() ;
		return hash;
	}

	public boolean matchByName(String name) {
		if (this.name.equals(name)) {
			return true;
		}
		return false;
	}

	public boolean matchBySurname(String surname) {
		if (this.surname.equals(surname)) {
			return true;
		}
		return false;
	}

	public boolean matchByAge(int age) {
		if (this.age == age) {
			return true;
		}
		return false;
	}

	public boolean matchByPhone(String phone) {
		if (this.phone.equals(phone)) {
			return true;
		}
		return false;
	}
}
